// import _ from 'underscore'

/**
 * 路由配置
 * @type {Object}
 */
const routesConfig = {

  system: '系统管理',
  admin: '管理员管理',
  adminList: '管理员列表',
  adminNew: '新增管理员',
  adminEdit: {
    name: '管理员详情',
    paramName: 'id'
  },
  role: '角色管理',
  roleList: '角色列表',
  roleNew: '新增角色',
  roleEdit: {
    name: '角色详情',
    paramName: 'id'
  },
  permission: {
    name: '平台权限配置',
    paramName: 'id'
  },
  appPermission: {
    name: '小程序权限配置',
    paramName: 'id'
  },
  userList: '用户列表',
  wechatUserEdit: {
    name: '微信用户详情',
    paramName: 'id'
  },
  goodsList: '商品列表',
  goodsInfo: {
    name: '商品详情',
    paramName: 'id'
  },
  orderInfo: {
    name: '订单详情',
    paramName: 'id'
  },

  payList: '授权列表',
  payInfo: {
    name: '授权详情',
    paramName: 'id'
  },
  retairInfo: {
    name: '退款详情',
    paramName: 'id'
  },
  orderConfirm: {
    name: '订单确认',
    paramName: 'id'
  },
  addStudioUser: {
    name: '新增用户'
  },
  editStudioUser: {
    name: '编辑用户',
    paramName: 'id'
  },
  studioUserList: {
    name: '用户管理'
  },
  /**
   * 获取路由
   * @param  {String | Object} key   路由键
   * @param  {*} param 参数
   * @param  {String | Array} breadcrumb 自定义面包屑
   * @return {Object}       路由数据对象
   */
  getRoute (key, param, breadcrumb) {
    var result = {}
    if (key instanceof Object) {
      result.name = key.name
      result.params = {}
      if (param) {
        result.params[key.paramName] = param
      }
      if (breadcrumb) {
        result.params.bread_crumb = breadcrumb
      }
    } else {
      result.name = key
    }
    return result
  },
  /**
   * 获取带query参数的路由
   * @param  {String | Object} key   路由键
   * @param  {Object} query 参数
   * @param  {String | Array} breadcrumb 自定义面包屑
   * @return {Object}       路由数据对象
   */
  getRouteWithQuery (key, query, breadcrumb) {
    var result = {}
    if (key instanceof Object) {
      result.name = key.name
    } else {
      result.name = key
    }
    result.query = query
    if (breadcrumb) {
      result.params = {}
      result.params.bread_tail = breadcrumb
    }
    return result
  }
}

export default routesConfig
